﻿using System;
using System.Collections.ObjectModel;
using System.ComponentModel;

namespace Flare
{

    public interface IPubFunctionMainWindow
    {
        void ShowPage(Type page, object id = null, bool IsBack = false, bool replace_current = false);
        void Panic(string _header, string _content, Exception ex);
        void Panic(glob.PanicType panic, Exception ex);
        void ShowNotice(string _content);
        void CreateFunctionalPanel(object[] _items);
        void RefreshResourceByName(string _resource_name);
    }
    
    public interface ITypicalPage
    {
        string name { get; }
    }

    public interface IPubTypicalPage : ITypicalPage
    {
        void SetSearchString(string _content);
        void CreateStartMenu();
    }
    
    public class NetworkEntityStatus : INotifyPropertyChanged
    {
        public string name { get; set; }
        public string ip { get; set; }
        long? _delay = null;
        public long? delay
        {
            get
            {
                return _delay;
            }
            set
            {
                if (_delay != value)
                {
                    _delay = value;
                    PropertyChanged(this, new PropertyChangedEventArgs("delay"));
                }
            }
        }

        int _lost = 0;
        public int lost
        {
            get
            {
                return _lost;
            }
            set
            {
                if (_lost != value)
                {
                    _lost = value;
                    PropertyChanged(this, new PropertyChangedEventArgs("lost"));
                }
            }
        }

        public event PropertyChangedEventHandler PropertyChanged = delegate { };
    }

    public struct SNetworkMapInsertEdit
    {
        public string Name { get; set; }
        public string IP { get; set; }
    }
}
